<%= jqgrid_stylesheets %>
<%= jqgrid_javascripts %>
<script type="text/javascript">
 
function handleSelection(id) {
  $('submitter').form.submit();
  return(true);
}

</script>
<div style="width:100%">
  <div id="dg" style="width:750px;margin:auto;">
      <% form_remote_tag :id => 'submitter', :url => { :action => "add_to_pseudo_cart"} do -%>
    <%= jqgrid("Variables", "variable_grid", "/surveys/data",
      [
        { :field => "name", :label => "Name",:width => 100},
        { :field => "value", :label => "Description",:width => 400 },
        { :field => "survey", :label => "Survey name",:width => 100 },
        { :field => "survey", :label => "Survey type",:width => 100 }
      ],
      {:selection_handler => "handleSelection", :multi_selection => true }
    ) %>
<br/>
<br/>
<a href="add_to_pseudo_cart" id="variable_grid_select_button">Get ID of selected row</a>
    <%= submit_tag 'Add selected variables to cart'%>
    <% end %>
  </div>
</div>

